<%@ page language="java"  contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.edu.service.*" %>  
<%@ page import="com.edu.entity.*" %> 
<%@ page import="java.util.*" %>           
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	   *{
	   	   margin: 0px;
	   	   padding: 0px;
	   }
	   table,tr,td{
	   	  border:1px solid black;
	   }
	   table{
	   	  width: 800px;
	   	  margin:auto;
	   	  margin-top: 100px;
	   }
	   table tr td{
	   	  padding-left:30px;
	   }
	</style>
</head>
<body>
<%
       
        Service sc=new Service();
	    List<Student> s=sc.getMess();  
	%>
	
<form id="form1" action="dodl.jsp" method="post">
<div>
    序号:<input type="text">
    用户名:<input type="text">
    年龄:<input type="text">
    性别:<input type="text"><br/><br/>
    <input type="button" onclick="changeAction('doSelectByStudent.jsp')" value="查询">&nbsp;&nbsp;
    <input type="button" onclick="changeAction('doAdd.jsp')" value="添加">&nbsp;&nbsp;
    <input type="button" onclick="changeAction('doDeleteSelectAll.jsp')" value="删除">&nbsp;&nbsp;
    <input type="button" value="修改" onclick="changeAction('doStudentUpdate2')">&nbsp;&nbsp;
    <input type="reset" value="重置">
</div>
    <table>
		  <tr>
		    <td>全选</td>
		  	<td>序号</td>
		  	<td>姓名</td>
		  	<td>年龄</td>
		  	<td>性别</td>
		  	<td>操作1</td>
		  	<td>操作2</td>
		  	<td>操作3</td>
		 </tr> 	
		 <%
		    for(int i=0;i<s.size();i++){
		    	 Student stu=s.get(i);
		 %>
		  
		   <tr>
		    <td><input type="checkbox" name="checkbox" name="checkbox" value="<%=stu.getId() %>"></td>
		  	<td><%=stu.getId() %></td>
		  	<td><%=stu.getName() %></td>
		  	<td><%=stu.getAge() %></td>
		  	<td><%=stu.getSex() %></td>
		  	<td><input type="button" value="删除" onclick="mysubmit1(this)"></td>
		  	<td><a href="doStudentDelete.jsp?uid=<%=stu.getId()%>">删除</a></td>
		  	<td><a href="doStudentUpdate.jsp?uid=<%=stu.getId()%>&sname=<%=stu.getName() %>&sage=<%=stu.getAge() %>&ssex=<%=stu.getSex() %>">修改</a></td>	  							
		  </tr>
		  <%
		    }
		  %>
	</table>
	<input type="hidden" id="uid" value="" name="uid">
</form>
</body>
	<script>
	 function $(id){
		   return document.getElementById(id);
	   }
	   function mysubmit1(o){
		   var uid=o.parentNode.parentNode.firstElementChild.nextElementSibling.innerHTML;
		   $("uid").value=uid;
		   var result=confirm("确认删除,删除后将无法恢复");
		   if(result){
			   $("form1").submit(); 
		   }
		      
	   }
	   function changeAction(url){
		   $("form1").action=url;
		   $("form1").submit();
	   }
	</script>	
</html>